import request from '@/utils/request'

// 获取积分商品列表
export function getIntegralList(params) {
  return request({
    url: '/api/back/goods/list',
    method: 'get',
    params
  })
}

// 商品上下架
export function changeIntegralStatus(data) {
  return request({
    url: '/api/back/goods/open',
    method: 'post',
    data
  })
}

// 添加或者编辑商品
export function editIntegralGoods({ name, score, stock_count, shop_id, cover, banners, must, detail, id, delivery_type }) {
  return request({
    url: '/api/back/goods/create',
    method: 'post',
    data: { name, score, stock_count, shop_id, cover, banners, must, detail, id, delivery_type }
  })
}
export function getIntegralOrderList(params) {
  return request({
    url: '/api/back/goods/order/list',
    method: 'get',
    params
  })
}

// 发货
export function integralShip(data) {
  return request({
    url: '/api/back/goods/order/deliver',
    method: 'post',
    data
  })
}

// 积分商品删除
export function delIntegral(data) {
  return request({
    url: '/api/back/goods/delete',
    method: 'post',
    data
  })
}

// 积分商品排序
export function sortIntegral(data) {
  return request({
    url: '/api/back/goods/sort',
    method: 'post',
    data
  })
}